<?php
define('NORMAL_ERROR', 100);
define('TOKEN_ERROR', 200);

class MobileError {
	private $response;
	
	public function __construct($response) {
		$this->response = $response;
	}
	
	
	public function normalError($msg){
		return $this->genJSONResult(NORMAL_ERROR, $msg);
	}
	
	public function tokenError($msg){
		return $this->genJSONResult(TOKEN_ERROR, $msg);
	}
	
	private function genJSONResult($code, $msg){
		$result = array();
		$result['code'] = $code;
		$result['message'] = $msg;
		
		$this->response->addHeaderNow('UDE Tag: error');
		return json_encode($result);
	}
}
?>